<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>小区物业管理系统 - 控制面板</title>
    <!-- Tailwind CSS v3 -->
    <script src="https://cdn.tailwindcss.com"></script>
    <!-- Font Awesome -->
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <!-- Chart.js -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.8/dist/chart.umd.min.js"></script>
    <!-- 统一的 Tailwind 配置 -->
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#1e40af',
                        secondary: '#3b82f6',
                        accent: '#60a5fa',
                        light: '#f3f4f6',
                        dark: '#1e293b'
                    },
                    fontFamily: {
                        sans: ['Inter', 'system-ui', 'sans-serif'],
                    }
                }
            }
        }
    </script>
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .bg-gradient-blue {
                background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
            }
            .text-shadow {
                text-shadow: 0 2px 4px rgba(0,0,0,0.1);
            }
            .transition-all-300 {
                transition: all 300ms ease-in-out;
            }
            .card {
                @apply bg-white rounded-md shadow-sm border border-gray-100;
            }
            .card-header {
                @apply p-4 border-b border-gray-100 font-medium text-gray-700 flex items-center justify-between;
            }
            .card-body {
                @apply p-4;
            }
            .nav-link {
                @apply flex items-center px-4 py-3 text-gray-600 hover:bg-blue-50 hover:text-blue-600 rounded-md transition-all-300;
            }
            .nav-link.active {
                @apply bg-blue-50 text-blue-600;
            }
            .nav-link i {
                @apply mr-3;
            }
            .btn {
                @apply px-4 py-2 rounded-md font-medium transition-all-300 focus:outline-none focus:ring-2 focus:ring-offset-2;
            }
            .btn-primary {
                @apply bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500;
            }
            .btn-outline {
                @apply border border-gray-300 text-gray-700 hover:bg-gray-50 focus:ring-gray-500;
            }
            .btn-sm {
                @apply px-3 py-1 text-sm;
            }
            .badge {
                @apply px-2 py-1 text-xs font-medium rounded-full;
            }
            .badge-success {
                @apply bg-green-100 text-green-800;
            }
            .badge-warning {
                @apply bg-yellow-100 text-yellow-800;
            }
            .badge-danger {
                @apply bg-red-100 text-red-800;
            }
            .badge-info {
                @apply bg-blue-100 text-blue-800;
            }
            .table-row-hover {
                @apply hover:bg-gray-50 transition-all-300;
            }
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <div class="flex h-screen overflow-hidden">
        <!-- 侧边导航栏 -->
        <aside class="w-64 bg-white shadow-sm hidden md:block">
            <!-- Logo -->
            <div class="flex items-center justify-center h-16 border-b border-gray-100">
                <div class="flex items-center">
                    <img src="https://p9-flow-imagex-sign.byteimg.com/tos-cn-i-a9rns2rl98/rc/pc/super_tool/c70bc843c62648c5ac1442b15138cda2~tplv-a9rns2rl98-image.image?rcl=20251027174223B6A1FC2217E476B2DCF3&rk3s=8e244e95&rrcfp=f06b921b&x-expires=1764150165&x-signature=fvtwF014Si8DyDXCBMppvkase%2BI%3D" 
                         alt="Property Management System Logo" 
                         class="w-8 h-8 mr-2">
                    <span class="text-lg font-semibold text-gray-800">物业管理系统</span>
                </div>
            </div>
            
            <!-- 导航菜单 -->
            <nav class="p-4 space-y-1">
                <a href="dashboard.html" class="nav-link active" data-target="dashboard-section">
                    <i class="fa fa-dashboard"></i>
                    <span>控制面板</span>
                </a>
                <a href="community.html" class="nav-link" data-target="community-section">
                    <i class="fa fa-building"></i>
                    <span>小区管理</span>
                </a>
                <a href="owners.html" class="nav-link" data-target="owners-section">
                    <i class="fa fa-users"></i>
                    <span>业主管理</span>
                </a>
                <a href="users.html" class="nav-link" data-target="users-section">
                    <i class="fa fa-user-circle"></i>
                    <span>用户管理</span>
                </a>
                <a href="maintenance.html" class="nav-link" data-target="maintenance-section">
                    <i class="fa fa-wrench"></i>
                    <span>报修管理</span>
                </a>
                <a href="announcements.html" class="nav-link" data-target="announcements-section">
                    <i class="fa fa-bullhorn"></i>
                    <span>公告管理</span>
                </a>
                <a href="fee_management.html" class="nav-link" data-target="fee-management-section">
                    <i class="fa fa-credit-card"></i>
                    <span>物业收费管理</span>
                </a>
                <a href="settings.html" class="nav-link" data-target="settings-section">
                    <i class="fa fa-cog"></i>
                    <span>系统设置</span>
                </a>
            </nav>
        </aside>
        
        <!-- 主内容区域 -->
        <div class="flex-1 flex flex-col overflow-hidden">
            <!-- 顶部导航栏 -->
            <header class="bg-white shadow-sm z-10">
                <div class="flex items-center justify-between h-16 px-6">
                    <!-- 移动端菜单按钮 -->
                    <button id="mobile-menu-button" class="md:hidden text-gray-500 hover:text-gray-700 focus:outline-none">
                        <i class="fa fa-bars"></i>
                    </button>
                    
                    <!-- 搜索框 -->
                    <div class="flex-1 max-w-md ml-4 md:ml-8">
                        <div class="relative">
                            <span class="absolute inset-y-0 left-0 flex items-center pl-3">
                                <i class="fa fa-search text-gray-400"></i>
                            </span>
                            <input type="text" placeholder="搜索..." class="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent">
                        </div>
                    </div>
                    
                    <!-- 用户菜单 -->
                    <div class="flex items-center space-x-4">
                        <!-- 通知 -->
                        <button class="relative text-gray-500 hover:text-gray-700 focus:outline-none">
                            <i class="fa fa-bell"></i>
                            <span class="absolute top-0 right-0 h-2 w-2 bg-red-500 rounded-full"></span>
                        </button>
                        <!-- 用户头像 -->
                        <div class="relative">
                            <button id="user-menu-button" class="flex items-center focus:outline-none">
                                <div class="w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center text-white">
                                    <i class="fa fa-user"></i>
                                </div>
                                <span class="ml-2 text-sm font-medium text-gray-700 hidden md:block">管理员</span>
                                <i class="fa fa-chevron-down ml-1 text-xs text-gray-400 hidden md:block"></i>
                            </button>
                            <!-- 用户下拉菜单 -->
                            <div id="user-menu" class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 z-20 hidden">
                                <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">个人资料</a>
                                <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">设置</a>
                                <div class="border-t border-gray-100"></div>
                                <a href="login.html" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">退出登录</a>
                            </div>
                        </div>
                    </div>
                </div>
            </header>
            
            <!-- 移动端侧边栏 -->
            <div id="mobile-sidebar" class="fixed inset-0 z-40 hidden">
                <div class="fixed inset-0 bg-gray-600 bg-opacity-75"></div>
                <div class="relative flex-1 flex flex-col max-w-xs w-full bg-white">
                    <div class="absolute top-0 right-0 -mr-12 pt-2">
                        <button id="close-sidebar-button" class="ml-1 flex items-center justify-center h-10 w-10 rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white">
                            <i class="fa fa-times text-white"></i>
                        </button>
                    </div>
                    <div class="flex-1 h-0 pt-5 pb-4 overflow-y-auto">
                        <div class="flex-shrink-0 flex items-center justify-center">
                            <img src="https://p9-flow-imagex-sign.byteimg.com/tos-cn-i-a9rns2rl98/rc/pc/super_tool/c70bc843c62648c5ac1442b15138cda2~tplv-a9rns2rl98-image.image?rcl=20251027174223B6A1FC2217E476B2DCF3&rk3s=8e244e95&rrcfp=f06b921b&x-expires=1764150165&x-signature=fvtwF014Si8DyDXCBMppvkase%2BI%3D" 
                                 alt="Property Management System Logo" 
                                 class="h-12 w-12">
                        </div>
                        <nav class="mt-5 px-2 space-y-1">
                            <a href="dashboard.html" class="nav-link active" data-target="dashboard-section">
                                <i class="fa fa-dashboard"></i>
                                <span>控制面板</span>
                            </a>
                            <a href="community.html" class="nav-link" data-target="community-section">
                                <i class="fa fa-building"></i>
                                <span>小区管理</span>
                            </a>
                            <a href="owners.html" class="nav-link" data-target="owners-section">
                                <i class="fa fa-users"></i>
                                <span>业主管理</span>
                            </a>
                            <a href="users.html" class="nav-link" data-target="users-section">
                                <i class="fa fa-user-circle"></i>
                                <span>用户管理</span>
                            </a>
                            <a href="maintenance.html" class="nav-link" data-target="maintenance-section">
                                <i class="fa fa-wrench"></i>
                                <span>报修管理</span>
                            </a>
                            <a href="announcements.html" class="nav-link" data-target="announcements-section">
                                <i class="fa fa-bullhorn"></i>
                                <span>公告管理</span>
                            </a>
                            <a href="fee_management.html" class="nav-link" data-target="fee-management-section">
                                <i class="fa fa-credit-card"></i>
                                <span>物业收费管理</span>
                            </a>
                            <a href="settings.html" class="nav-link" data-target="settings-section">
                                <i class="fa fa-cog"></i>
                                <span>系统设置</span>
                            </a>
                        </nav>
                    </div>
                </div>
            </div>
            
            <!-- 页面内容 -->
            <main class="flex-1 overflow-y-auto p-6 bg-gray-50">
                <!-- 控制面板 -->
                <section id="dashboard-section" class="space-y-6">
                    <h1 class="text-2xl font-bold text-gray-800">控制面板</h1>
                    
                    <!-- 统计卡片 -->
                    <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6">
                        <!-- 总业主数 -->
                        <div class="card">
                            <div class="card-body">
                                <div class="flex items-start justify-between">
                                    <div>
                                        <p class="text-sm font-medium text-gray-500">总业主数</p>
                                        <h3 class="text-2xl font-bold text-gray-900 mt-1">256</h3>
                                        <p class="text-xs text-green-600 mt-2 flex items-center">
                                            <i class="fa fa-arrow-up mr-1"></i>
                                            <span>较上月增长 5.2%</span>
                                        </p>
                                    </div>
                                    <div class="p-2 bg-blue-100 rounded-full">
                                        <i class="fa fa-users text-blue-600"></i>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 待处理报修 -->
                        <div class="card">
                            <div class="card-body">
                                <div class="flex items-start justify-between">
                                    <div>
                                        <p class="text-sm font-medium text-gray-500">待处理报修</p>
                                        <h3 class="text-2xl font-bold text-gray-900 mt-1">12</h3>
                                        <p class="text-xs text-red-600 mt-2 flex items-center">
                                            <i class="fa fa-arrow-up mr-1"></i>
                                            <span>较昨日增加 3</span>
                                        </p>
                                    </div>
                                    <div class="p-2 bg-yellow-100 rounded-full">
                                        <i class="fa fa-wrench text-yellow-600"></i>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 本月收入 -->
                        <div class="card">
                            <div class="card-body">
                                <div class="flex items-start justify-between">
                                    <div>
                                        <p class="text-sm font-medium text-gray-500">本月收入</p>
                                        <h3 class="text-2xl font-bold text-gray-900 mt-1">¥32,500</h3>
                                        <p class="text-xs text-green-600 mt-2 flex items-center">
                                            <i class="fa fa-arrow-up mr-1"></i>
                                            <span>较上月增长 12.3%</span>
                                        </p>
                                    </div>
                                    <div class="p-2 bg-green-100 rounded-full">
                                        <i class="fa fa-line-chart text-green-600"></i>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 公告数量 -->
                        <div class="card">
                            <div class="card-body">
                                <div class="flex items-start justify-between">
                                    <div>
                                        <p class="text-sm font-medium text-gray-500">公告数量</p>
                                        <h3 class="text-2xl font-bold text-gray-900 mt-1">8</h3>
                                        <p class="text-xs text-blue-600 mt-2 flex items-center">
                                            <i class="fa fa-bullhorn mr-1"></i>
                                            <span>本月新增 3 条</span>
                                        </p>
                                    </div>
                                    <div class="p-2 bg-purple-100 rounded-full">
                                        <i class="fa fa-bullhorn text-purple-600"></i>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 图表和最近活动 -->
                    <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
                        <!-- 报修趋势 -->
                        <div class="card lg:col-span-2">
                            <div class="card-header">
                                <h3>报修趋势</h3>
                                <div class="flex space-x-2">
                                    <button class="btn btn-sm btn-outline">周</button>
                                    <button class="btn btn-sm btn-primary">月</button>
                                    <button class="btn btn-sm btn-outline">年</button>
                                </div>
                            </div>
                            <div class="card-body">
                                <canvas id="maintenanceChart" height="250"></canvas>
                            </div>
                        </div>
                        
                        <!-- 报修类型分布 -->
                        <div class="card">
                            <div class="card-header">
                                <h3>报修类型分布</h3>
                            </div>
                            <div class="card-body">
                                <canvas id="maintenanceTypeChart" height="250"></canvas>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 最近活动 -->
                    <div class="card">
                        <div class="card-header">
                            <h3>最近活动</h3>
                        </div>
                        <div class="card-body">
                            <div class="overflow-x-auto">
                                <table class="min-w-full divide-y divide-gray-200">
                                    <thead>
                                        <tr>
                                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作内容</th>
                                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作人</th>
                                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作时间</th>
                                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">状态</th>
                                        </tr>
                                    </thead>
                                    <tbody class="bg-white divide-y divide-gray-200">
                                        <tr class="table-row-hover">
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <div class="flex items-center">
                                                    <div class="flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-full bg-blue-100">
                                                        <i class="fa fa-wrench text-blue-600"></i>
                                                    </div>
                                                    <div class="ml-3">
                                                        <div class="text-sm font-medium text-gray-900">报修处理</div>
                                                        <div class="text-sm text-gray-500">已处理电梯故障报修 #00123</div>
                                                    </div>
                                                </div>
                                            </td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">张维修</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">10分钟前</td>
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <span class="badge badge-success">已完成</span>
                                            </td>
                                        </tr>
                                        <tr class="table-row-hover">
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <div class="flex items-center">
                                                    <div class="flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-full bg-green-100">
                                                        <i class="fa fa-check-circle text-green-600"></i>
                                                    </div>
                                                    <div class="ml-3">
                                                        <div class="text-sm font-medium text-gray-900">报修完成</div>
                                                        <div class="text-sm text-gray-500">水管漏水报修 #00122 已完成</div>
                                                    </div>
                                                </div>
                                            </td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">李师傅</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">1小时前</td>
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <span class="badge badge-success">已完成</span>
                                            </td>
                                        </tr>
                                        <tr class="table-row-hover">
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <div class="flex items-center">
                                                    <div class="flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-full bg-purple-100">
                                                        <i class="fa fa-bullhorn text-purple-600"></i>
                                                    </div>
                                                    <div class="ml-3">
                                                        <div class="text-sm font-medium text-gray-900">发布公告</div>
                                                        <div class="text-sm text-gray-500">发布了新公告《小区停水通知》</div>
                                                    </div>
                                                </div>
                                            </td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">王经理</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2小时前</td>
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <span class="badge badge-info">已发布</span>
                                            </td>
                                        </tr>
                                        <tr class="table-row-hover">
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <div class="flex items-center">
                                                    <div class="flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-full bg-yellow-100">
                                                        <i class="fa fa-user-plus text-yellow-600"></i>
                                                    </div>
                                                    <div class="ml-3">
                                                        <div class="text-sm font-medium text-gray-900">新业主登记</div>
                                                        <div class="text-sm text-gray-500">新增业主：张三，3栋101室</div>
                                                    </div>
                                                </div>
                                            </td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">管理员</td>
                                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">昨天</td>
                                            <td class="px-6 py-4 whitespace-nowrap">
                                                <span class="badge badge-success">已完成</span>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </section>
            </main>
        </div>
    </div>

    <script>
        // 页面加载完成后执行
        document.addEventListener('DOMContentLoaded', function() {
            // 移动端菜单按钮
            const mobileMenuButton = document.getElementById('mobile-menu-button');
            const mobileSidebar = document.getElementById('mobile-sidebar');
            const closeSidebarButton = document.getElementById('close-sidebar-button');
            
            mobileMenuButton.addEventListener('click', function() {
                mobileSidebar.classList.remove('hidden');
            });
            
            closeSidebarButton.addEventListener('click', function() {
                mobileSidebar.classList.add('hidden');
            });
            
            // 用户菜单切换
            const userMenuButton = document.getElementById('user-menu-button');
            const userMenu = document.getElementById('user-menu');
            
            userMenuButton.addEventListener('click', function() {
                userMenu.classList.toggle('hidden');
            });
            
            // 点击页面其他地方关闭下拉菜单
            document.addEventListener('click', function(event) {
                if (!userMenuButton.contains(event.target) && !userMenu.contains(event.target)) {
                    userMenu.classList.add('hidden');
                }
            });
            
            // 初始化图表
            // 报修趋势图表
            const maintenanceCtx = document.getElementById('maintenanceChart').getContext('2d');
            const maintenanceChart = new Chart(maintenanceCtx, {
                type: 'line',
                data: {
                    labels: ['1日', '5日', '10日', '15日', '20日', '25日', '30日'],
                    datasets: [
                        {
                            label: '已完成',
                            data: [8, 12, 15, 10, 14, 18, 20],
                            borderColor: '#10b981',
                            backgroundColor: 'rgba(16, 185, 129, 0.1)',
                            tension: 0.3,
                            fill: true
                        },
                        {
                            label: '处理中',
                            data: [5, 3, 6, 4, 8, 5, 7],
                            borderColor: '#f59e0b',
                            backgroundColor: 'rgba(245, 158, 11, 0.1)',
                            tension: 0.3,
                            fill: true
                        }
                    ]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            position: 'top',
                        }
                    },
                    scales: {
                        y: {
                            beginAtZero: true
                        }
                    }
                }
            });
            
            // 报修类型分布图表
            const maintenanceTypeCtx = document.getElementById('maintenanceTypeChart').getContext('2d');
            const maintenanceTypeChart = new Chart(maintenanceTypeCtx, {
                type: 'doughnut',
                data: {
                    labels: ['水电维修', '电梯故障', '公共设施', '其他'],
                    datasets: [{
                        data: [40, 25, 20, 15],
                        backgroundColor: [
                            '#3b82f6',
                            '#ef4444',
                            '#8b5cf6',
                            '#6b7280'
                        ],
                        borderWidth: 0
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                        legend: {
                            position: 'bottom',
                        }
                    },
                    cutout: '65%'
                }
            });
        });
    </script>
</body>
</html>